<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<div style="display: none"><script id="myEditorImageID" type="text/plain"></script></div>
<div class="pageContent">
	<form method="post" action="${rootUrl}/info/index-data<c:if test="${indexData.id != 0 && indexData.id != '' }">/${indexData.id}</c:if>" class="pageForm required-validate" onsubmit="return saveCallBack(this);">
		<c:if test="${indexData.id != 0 && indexData.id != '' }"><input type="hidden" name="_method" value="put"></c:if>
		<input type="hidden" name="indexData.id" value="${indexData.id }">
		<input type="hidden" name="indexData.indexClass.id" value="${indexData.indexClass.id }">
		<div class="pageFormContent" layoutH="56">
			<p>
				<label>平台类别：</label>
				<input type="text" size="30" readonly="readonly" value="<c:if test="${indexData.indexClass.platform == 1 }">h5</c:if><c:if test="${indexData.indexClass.platform == 2 }">pc</c:if><c:if test="${indexData.indexClass.platform == 3 }">app</c:if>" />
			</p>
			<p>
				<label>展示类型：</label>
				<input type="text" size="30" readonly="readonly" value="${showType[indexData.indexClass.showType] }" />
			</p>
			<p>
				<label>标题：</label>
				<input type="text" name="indexData.title" size="30" value="${indexData.title }" />
			</p>
			<p>
				<label>数据类型：</label>
				<select class="combox" id="selCombox" name="indexData.dataType" onchange="selChange(this)">
					<option value="${indexData.dataType}">${indexDataType[indexData.dataType]}</option>
					<c:forEach var="item" items="${indexDataType}">   
						<option value="${item.key}" <c:if test="${indexData.dataType == item.key}">selected="selected"</c:if>>${item.value}</option>
					</c:forEach>
				</select>
			</p>
			<p>
				<label>数据值：</label>
				<input type="hidden" name="data.id" id="dataId" value="${indexData.dataId }" />
				<input type="text"  name="data.name" id="dataName" size="30" value="${indexData.dataName}"/>
				<a class="btnLook" id="dataId_1" href="${rootUrl}/goods/goods/1/dialog" width="1320" height="720" lookupGroup="data">商品列表</a>
				<a class="btnLook" id="dataId_2" style="display: none;" href="${rootUrl}/goods/goods-class/1/showAll" width="800" height="720" lookupGroup="data">商品分类</a>
				<a class="btnLook" id="dataId_3" style="display: none;" href="${rootUrl}/goods/goods-class/1/showAll" width="800" height="720" lookupGroup="data">商品分类</a>
				<a class="btnLook" id="dataId_4" style="display: none;" href="${rootUrl}/info/article-class/1/showAll" width="800" height="720" lookupGroup="data">新闻分类</a>
				<a class="btnLook" id="dataId_5" style="display: none;" href="${rootUrl}/info/article/1/dialog" width="800" height="720" lookupGroup="data">新闻</a>
				<a class="btnLook" id="dataId_6" style="display: none;" href="${rootUrl}/goods/type-value/1/dialog2?typeClassId=${indexData.indexClass.dataId}" width="880" height="600" lookupGroup="data">商品类型</a>
				<a class="btnLook" id="dataId_7" style="display: none;" 
				<c:if test="${indexData.indexClass.dataType==2||indexData.indexClass.dataType==3}">href="${rootUrl}/goods/brand-goods-class/1/dialog?goodsClassId=${indexData.indexClass.dataId}"</c:if> 
				<c:if test="${indexData.indexClass.dataType!=2&&indexData.indexClass.dataType!=3}">href="${rootUrl}/goods/brand/1/dialog"</c:if>width="800" height="720" lookupGroup="data">品牌</a> 
                <a class="btnLook" id="dataId_8" onclick="iFileUploader.upFile('dataName','indexData_video');"><img id="indexData_video" src="${indexData.dataName}" />视频</a>
                <a class="text" id="dataId_9"></a>
                <a class="text" id="dataId_10"></a>
			</p>
			<p>
				<label>排序：</label>
				<input type="text" name="indexData.sort" size="30" value="${indexData.sort }" />
			</p>
			<p>
				<label>显示位置：</label>
				<select  name="indexData.position" >
					<option <c:if test="${indexClass.position == ''}">selected="selected"</c:if> value="">无</option>
					<option <c:if test="${indexClass.position == 1}">selected="selected"</c:if> value="1">左</option>
					<option <c:if test="${indexClass.position == 2}">selected="selected"</c:if> value="2">中</option>
					<option <c:if test="${indexClass.position == 3}">selected="selected"</c:if> value="3">右</option>
				</select>
			</p>
			<dl class="nowrap" >
				<dt>图片：</dt>
				<dd style="width: 300px;">
				<input name="indexData.image" id="IData" type="hidden" size="30" value="${indexData.image }"/>
				<div class="imgContainer" >
				<a href="#" onclick="iFileUploader.upImg('IData','myEditorImageD');"><img id="myEditorImageD" src="${indexData.image}" /></a>
				</div>
				</dd>
			</dl>
			
   		 </div>
    	<div class="formBar">
			<ul>
				<li><div class="buttonActive"><div class="buttonContent"><button id="theSubmit" type="submit">保存</button></div></div></li>
				<li>
					<div class="button"><div class="buttonContent"><button type="button" class="close">取消</button></div></div>
				</li>
			</ul>
			<c:if test=""></c:if>
		</div>
    </form>
    	
</div>
<script>
    var articleImageFolder = 2;
	iFileUploader.initImg("myEditorImageID","dataName","indexData_video",{imageFolder:articleImageFolder});
	iFileUploader.initFile("myEditorImageID","IData","myEditorImageD",{imageFolder:articleImageFolder});
	function selChange(obj){
		var idpos = $(obj).val() == "3" ? "2" : $(obj).val();
		var ids = ["1","2","3","4","5","6","7","8","9","10"];
		for(i =0;i<ids.length;i++){
			if(ids[i] == idpos){
				$("#dataId_"+ids[i]).show();
			}else{
				$("#dataId_"+ids[i]).hide();
			}
		}
	}
	selChange($("#selCombox"));
	
	function saveCallBack(obj){
		$("#dataId").attr("name","indexData.dataId");
		$("#dataName").attr("name","indexData.dataName");
		return validateCallback(obj, newDialogAjaxDone);
	}

</script>